Update endpoints watcher to not fetch pods for removed endpoints#10013
Update endpoints watcher to not fetch pods for removed endpoints#10013
Conversation
Signed-off-by: Alex Leong <alex@buoyant.io>
Signed-off-by: Alex Leong <alex@buoyant.io>
Signed-off-by: Alex Leong <alex@buoyant.io>
| } | ||
| } | ||
|
|
||
| // Test that when an EndpointSlice is scaled down, the EndpointsWatcher sends |
There was a problem hiding this comment.
nit: godoc should start with the function name
There was a problem hiding this comment.
I don't think we typically use godoc for tests, do we? (note the // rather than ///)
There was a problem hiding this comment.
Ok never mind, I thought one could use go doc to show docs from test functions, but that doesn't appear to be the case. OTOH, I'm not aware of the usage of ///, can you clarify?
There was a problem hiding this comment.
Nevermind, /// isn't a go thing. I got confused; holiday brain.
Signed-off-by: Alex Leong <alex@buoyant.io>
|
@adleong Nice fix! It took me some time to digest why In particular, I found it unclear why one method would be leaky while the other isn't. Will you please update the comment(s) to avoid future confusion? |
) Fixes #10003 When endpoints are removed from an EndpointSlice resource, the destination controller builds a list of addresses to remove. However, if any of the removed endpoints have a Pod as their targetRef, we will attempt to fetch that pod to build the address to remove. If that pod has already been removed from the informer cache, this will fail and the endpoint will be skipped in the list of endpoints to be removed. This results in stale endpoints being stuck in the address set and never being removed. We update the endpoint watcher to construct only a list of endpoint IDs for endpoints to remove, rather than fetching the entire pod object. Since we no longer attempt to fetch the pod, this operation is now infallible and endpoints will no longer be skipped during removal. We also add a `TestEndpointSliceScaleDown` test to exercise this. Signed-off-by: Alex Leong <alex@buoyant.io>
) Fixes #10003 When endpoints are removed from an EndpointSlice resource, the destination controller builds a list of addresses to remove. However, if any of the removed endpoints have a Pod as their targetRef, we will attempt to fetch that pod to build the address to remove. If that pod has already been removed from the informer cache, this will fail and the endpoint will be skipped in the list of endpoints to be removed. This results in stale endpoints being stuck in the address set and never being removed. We update the endpoint watcher to construct only a list of endpoint IDs for endpoints to remove, rather than fetching the entire pod object. Since we no longer attempt to fetch the pod, this operation is now infallible and endpoints will no longer be skipped during removal. We also add a `TestEndpointSliceScaleDown` test to exercise this. Signed-off-by: Alex Leong <alex@buoyant.io>
Fixes #10003
When endpoints are removed from an EndpointSlice resource, the destination controller builds a list of addresses to remove. However, if any of the removed endpoints have a Pod as their targetRef, we will attempt to fetch that pod to build the address to remove. If that pod has already been removed from the informer cache, this will fail and the endpoint will be skipped in the list of endpoints to be removed. This results in stale endpoints being stuck in the address set and never being removed.
We update the endpoint watcher to construct only a list of endpoint IDs for endpoints to remove, rather than fetching the entire pod object. Since we no longer attempt to fetch the pod, this operation is now infallible and endpoints will no longer be skipped during removal.
We also add a
TestEndpointSliceScaleDowntest to exercise this.